<?php
/*
	结算管理
*/
defined('BY_JYA') or exit('error');
cfc('core')->checklogin();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';

if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	$params['mid']=$_SESSION['uid'];
	if(isset($_RQ['status'])){
		$params['status']=intval($_RQ['status']);
		$return['params']['status']=$_RQ['status'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 20;
	$total='';
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'orderby'=>'id desc',
	);
	$list=$this->get_list('balance',$parameter,$total);
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'待审核','query'=>'status=0'),
			array('op'=>'list','title'=>'待打款','query'=>'status=1'),
			array('op'=>'list','title'=>'已打款','query'=>'status=2'),
			array('op'=>'list','title'=>'审核不通过','query'=>'status=4'),
		),
		'list'=>array('data'=>'list','edit'=>false,'delall'=>false,'del_one'=>false,'list'=>array(
			array('name'=>'balancesn','title'=>'结算单号','type'=>'string'),
			array('name'=>'fee','title'=>'金额','type'=>'price'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'statuss'),
			array('name'=>'createtime','title'=>'创建时间','type'=>'time'),
			array('name'=>'pay_type','title'=>'付款方式','type'=>'radio','options'=>'pay_types'),
			array('name'=>'pay_id','title'=>'付款单号','type'=>'string'),
		)),
		
	);
	if($_SESSION['os']=='windows'){
		$return['htmls']=$htmls;
	}
	$return['pay_types']=array(
		'1'=>'微信支付',
		'2'=>'支付宝支付',
		'3'=>'银联转账',
	);
	$return['statuss']=array(
		'0'=>'待审核',
		'1'=>'待打款',
		'2'=>'已打款',
		'4'=>'审核不通过',
	);
	exi($return);
}
